package j2024.j202409;

public class j0903 {
    /**
     * 62. 不同路径
     * @param m
     * @param n
     * @return
     */
    public int uniquePaths(int m, int n) {
        int[][] me = new int[m+1][n+1];
        return dfs(m,n,me);
    }
    public int dfs(int i,int j,int[][] me){
        if(i==1 && j==1){
            me[i][j] = 1;
            return 1;
        }
        if(me[i][j]!=0){
            return me[i][j];
        }
        if(i==0 || j==0){
            return 0;
        }
        me[i][j] = dfs(i-1,j,me)+dfs(i,j-1,me);
        return me[i][j];
    }
}
